<template>
	<view class="head-box">
		<view class="h-s-box">
			<view class="h-t-bx h-t-bx-w">
				<view class="lb-txt">{{allPurchMoney}}</view>
				<view class="val-txt">{{money}}</view>
			</view>
			<view class="h-t-bx h-t-bx-w">
				<view class="lb-txt">{{allPurchNumTxt}}</view>
				<view class="val-txt ">{{salesVolume}}</view>
			</view>
			<view class="h-t-bx h-t-bx-w">
				<view class="lb-txt">{{allPurchOrdTxt}}</view>
				<view class="val-txt">{{oddNumber}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	import lang from "../../../js/conf/Lang.js";
	export default
	{
		data()
		{
			return {
				money : 0, //今日销售额
				salesVolume : 0, //销量
				oddNumber : 0, //订单数量
				allPurchMoney : lang.report.allPurchMoney,
				allPurchNumTxt : lang.report.allPurchNumTxt,
				allPurchOrdTxt : lang.report.allPurchOrdTxt,
				toTxt : lang.saleReport.toTxt,
			}
		},
		methods:{
			setData(data,item)
			{
				let timeId = item.group;
				if(timeId == "")//全部
				{
					this.allPurchMoney = lang.report.allPurchMoney;
					this.allPurchNumTxt = lang.report.allPurchNumTxt;
					this.allPurchOrdTxt = lang.report.allPurchOrdTxt;
				}
				else if(timeId == 1)//今日
				{
					this.allPurchMoney = lang.report.dPurchTxt;
					this.allPurchNumTxt = lang.report.dPurchNumTxt;
					this.allPurchOrdTxt = lang.report.dPurchOrdTxt;
				}
				else if(timeId == 2)//本月
				{
					this.allPurchMoney = lang.report.mPurchTxt;
					this.allPurchNumTxt = lang.report.mPurchNumTxt;
					this.allPurchOrdTxt = lang.report.mPurchOrdTxt;
				}
				else if(timeId == 3)//季度
				{
					this.allPurchMoney = lang.report.sePurchTxt;
					this.allPurchNumTxt = lang.report.sePurchNumTxt;
					this.allPurchOrdTxt = lang.report.sePurchOrdTxt;
				}
				else if(timeId == 5)//自定义
				{
					if(item.stime == item.dtime)
					{
						this.allPurchMoney = item.stime + lang.purchcaseTxt + lang.eTxt;
						this.allPurchNumTxt =  item.stime + lang.purchcaseTxt + lang.liangTxt;
						this.allPurchOrdTxt = item.stime + lang.purchcaseTxt + lang.saleReport.oddNumberTxt;
					}
					else
					{
						this.allPurchMoney = item.stime + this.toTxt + item.dtime + lang.purchcaseTxt + lang.eTxt;;
						this.allPurchNumTxt =  item.stime + this.toTxt + item.dtime + lang.purchcaseTxt + lang.liangTxt;
						this.allPurchOrdTxt = item.stime + this.toTxt + item.dtime + lang.purchcaseTxt + lang.saleReport.oddNumberTxt;
					}
				}
				
				this.money =  data.money//今日销售额
				this.salesVolume = data.salesVolume//销量
				this.oddNumber = data.oddNumber//订单数量
			}
		}
		
	}
</script>

<style lang="scss">
	.head-box
	{
		padding: 15px 80px;
		height: 60px;
		width: calc(100% - 160px) ;
		border-bottom: 1px #EDEDED solid;
		.h-s-box
		{
			display: flex;
			align-items: center;
			// justify-content: space-between;
			justify-content: space-around;
			.h-t-bx
			{
				font-size: #ff6600;
				
				.lb-txt
				{
					font-size: 16px;
					text-align: center;
				}
				.val-txt
				{
					color: #3388ff;
					text-align: center;
					font-size:20px;
					font-weight: bold;
				}
				.val-txt-normal
				{
					font-weight: normal;
					color: #333;
				}
				.val-txt-red
				{
					color: red;
				}
			}
			.h-t-bx-w
			{
				width: 50%;
			}
			
			.h-t-bx-w33
			{
				width:33%;
			}
			
		}
	
	}
</style>
